<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" isELIgnored="false" isELIgnored="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>众筹管理后台</title>
		<link rel="stylesheet" href="admin/css/bootstrap.min.css" />
		<link rel="stylesheet" href="admin/css/dashboard.css" />
	</head>
	<body>
		<div id="getPsID" disabled="none">${psId}
		</div>
		<nav class="navbar navbar-inverse navbar-fixed-top">
			<div class="container-fluid">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false"
					 aria-controls="navbar">
						<span class="sr-only">Toggle navigation</span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</button>
					<a class="navbar-brand" href="#">众筹管理平台</a>
				</div>
				<div id="navbar" class="navbar-collapse collapse">
					<ul class="nav navbar-nav navbar-right">
						<li><a href="index.html">首页</a></li>
						<li><a href="#">欢迎, ${sessionScope.admin.adminName}</a></li>
						<!-- <li><a href="#" title="修改个人资料和密码的页面">设置</a></li> -->
						<li><a href="logout" title="退出登录">退出</a></li>
					</ul>
				</div>
			</div>
		</nav>
		<div class="container-fluid">
			<div class="row">
				<div class="col-sm-3 col-md-2 sidebar">
					<ul class="nav nav-sidebar">
						<li class="active"><a href="toBackstageIndex">首页</a></li>
					</ul>
					<ul class="nav nav-sidebar">
						<li><a href="toBackProducts">所有项目</a></li>
						<li><a href="toBackProducts">项目审核</a></li>
						<!-- <li><a href="toBackProducts">项目跟踪</a></li> -->
						<li><a href="toBackProducts">项目评论</a></li>
						<li><a href="toBackProducts">项目分类</a></li>
						<li><a href="toBackProducts">项目推荐</a></li>
					</ul>
					<ul class="nav nav-sidebar">
						<li><a href="toBackManages">用户管理</a></li>
						<li><a href="toBackManages">用户资金</a></li>
						<li><a href="toBackManages">实名审核</a></li>
						<li><a href="toBackManages">新闻管理</a></li>
						<li><a href="toBackManages">添加新闻</a></li>
					</ul>
					<ul class="nav nav-sidebar">
						<li><a href="">新闻管理</a></li>
						<li><a href="">问题管理</a></li>
						<li><a href="${pageContext.request.contextPath}/back/user/list.action">管理用户</a></li>
						<li><a href="">管理日志</a></li>
					</ul>
				</div>

				<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
					<h1 class="page-header">XXX项目</h1>

					<ul id="productinfo" class="nav nav-tabs">
						<li role="presentation" class="active"><a href="#product-info1" data-toggle="tab">基本信息</a></li>
						<li role="presentation"><a href="#product-info2" data-toggle="tab">项目信息</a></li>
						<li role="presentation"><a href="#product-info3" data-toggle="tab">项目评论</a></li>
						<li role="presentation"><a href="#product-info4" data-toggle="tab">项目进度</a></li>
				
					</ul>
					<div id="productinfo1" class="tab-content">
						<div class="panel panel-default tab-pane active" id="product-info1">
							<div class="panel-heading">
								<h3 class="panel-title">申请人信息</h3>
							</div>
							<div class="panel-body">
								<!-- <p>以下内容仅做示例</p> -->
								<table id="jibenxinxiId" class="table table-bordered">

									
								</table>
							</div>
						</div>
						<div class="panel panel-default tab-pane" id="product-info2">
							<div class="panel-heading">
								<h3 class="panel-title">项目信息</h3>
							</div>
							<div class="panel-body">
								<!-- <p>以下内容仅做示例</p> -->
								<table id="xiangmuxinixiId" class="table table-bordered">

									
								</table>
							</div>
						</div>
						<div class="panel panel-default tab-pane" id="product-info3">
							<div class="panel-heading">
								<h3 class="panel-title">项目评论</h3>
							</div>
							<div class="panel-body">
								<p id="xiangmupinglunId_msg"></p>
								<table id="xiangmupinglunId" class="table table-bordered">
									<thead>
										<tr>
											<th>评论内容</th>
											<th>评论人</th>
											<th>评论时间</th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody id="xiangmu-pinglun">
									</tbody>
								</table>
							</div>
						</div>
						<div class="panel panel-default tab-pane" id="product-info4">
							<div class="panel-heading">
								<h3 class="panel-title">项目进度</h3>
							</div>
							<div class="panel-body">
								<p id="xiangmujinduId_msg"></p>
								<div class="progress">
								  <div id="xianfmuprogress" class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="min-width: 2em;">
								    0%
								  </div>
								</div>
								<table id="xiangmujinduId_tab" class="table table-bordered">
									
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

		<script type="text/javascript" src="${pageContext.request.contextPath}/admin/js/jquery1.12.4.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/admin/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/admin/js/countUp.js"></script>
		<script type="text/javascript">
			$(function(){
				var psId=$("#getPsID").html()
				//alert(psId)
				$('a[href="#product-info1"]').click(function(){
					$("#productinfo>li").removeClass("active");
				$("#productinfo1>div").removeClass("active");
					$('a[href="#product-info1"]').parent().addClass("active");
					$("#product-info1").addClass("active");
				})
				$('a[href="#product-info2"]').click(function(){
					$("#productinfo>li").removeClass("active");
				$("#productinfo1>div").removeClass("active");
					$('a[href="#product-info2"]').parent().addClass("active");
					$("#product-info2").addClass("active");
				})
				$('a[href="#product-info3"]').click(function(){
					$("#productinfo>li").removeClass("active");
				$("#productinfo1>div").removeClass("active");
					$('a[href="#product-info3"]').parent().addClass("active");
					$("#product-info3").addClass("active");
				})
			})
			//得到项目基本信息
			$(function(){
				$.ajax({
					url: "getProjectDetaile",
					dataType: "JSON",
					type: "get",
					data: {
						psId: $("#getPsID").html()
					},
					success: function(result) {
						var map = result.extend["map"]
						jibenxinxi(map)
						xiangmuxinxi(map)
						xiangmupinglun(map)
						xiangmujindu(map)
					},
					error: function(err) {}
				})
			})
			function jibenxinxi(map){
				var users=map["projects"].users
				var projects = map["projects"]
				var msg = ""
				
				msg+="<tr>"+"<th>申请人</th>"+"<td>"+users.usName+"</td>"+"</tr>"+
					"<tr>"+"<th>申请人身份证</th>"+"<td>"+users.usIdcard+"</td>"+"</tr>"+
					"<tr>"+"<th>申请人地址</th>"+"<td>"+users.usAddress+"</td>"+"</tr>"+
					"<tr>"+"<th>客服联系人</th>"+"<td>"+projects.psCustName+"</td>"+"</tr>"+
					"<tr>"+"<th>客服联系电话</th>"+"<td>"+projects.psCustPhone+"</td>"
				$("#jibenxinxiId").html(msg)
			}
			function xiangmuxinxi(map){
				console.log(map)
				var projects = map["projects"]
				var msg=""
				msg+="<tr><th>项目类型</th><td>"+projects.projectsType.pstName+"</td></tr>"+
					"<tr><th>项目标题</th><td>"+projects.psName+"</td></tr>"+
					"<tr><th>筹款目的</th><td>"+projects.psGoal+"</td></tr>"+
					"<tr><th>项目地点</th><td>"+projects.psAddress+"</td></tr>"+
					"<tr><th>筹资金额</th><td>"+projects.psMoney+"</td></tr>"+
					"<tr><th>筹资天数</th><td>"+projects.psDays+"</td></tr>"
					/* "<tr><th>自定义标签</th><td>"xxxxxx,xxx,xx,xx,"</td> */
					/* "</tr><tr><th>封面图</th><td>图片</td></tr>" */
					/* "<tr><th>其它</th><td>这只是个示例</td></tr>" */
					$("#xiangmuxinixiId").html(msg)
			}
			function xiangmupinglun(map){
				console.log(map)
				var projects = map["projects"]
				if(projects.psType==0){
					$("#xiangmupinglunId_msg").html("未审核")
					//alert(projects.psType)
				}else if(projects.psType==5){
					$("#xiangmupinglunId_msg").html("审核失败")
				}else{
					var msg=""
					$.each(map["page"].list,function(i,item){
						msg+="<tr>"+
							"<th>"+item.cmContent+"</th>"+
							"<th>"+item.users.usName+"</th>"+
							"<th>"+item.cmTime+"</th>"+
							"<th>删除</th>"+
							"</tr>"	
					})
					$("#xiangmu-pinglun").html(msg)
				}
			}
			function xiangmujindu(map){
				console.log(map)
				var progress = map["progress"]
				var projects = map["projects"]
				
				if(projects.psType==0){
					$("#xiangmujinduId_msg").html("未审核")
					//alert(projects.psType)
				}else if(projects.psType==5){
					$("#xiangmujinduId_msg").html("审核失败")
				}else{
					//alert(123)
					var psMoney = projects.psMoney
					var psGetmoney = projects.psGetmoney
					if(progress>1){
						progress = "100%"
					}else{
						progress = parseInt(parseFloat(progress)*100)+"%"
					}
					$("#xianfmuprogress").css("width",progress)
					$("#xianfmuprogress").html(progress)
					//alert(parseFloat(progress)*100+"%")
					var msg=""
					msg += "<tr>"+"<th>项目进度</th>"+"<td>"+progress+"</td>"+"</tr>"+
						"<tr>"+"<th>预筹金额</th>"+"<td>"+psMoney+"</td>"+"</tr>"+
						"<tr>"+"<th>已筹金额</th>"+"<td>"+psGetmoney+"</td>"+"</tr>"	
					
					$("#xiangmujinduId_tab").html(msg)
				}
				
				
			}
		</script>
	</body>
</html>
